﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core.Comamad
{
    public class BaseQuanLi
    {

        #region Singleton
        private static BaseQuanLi _Instance;
        private static object locks = new object();

        public static BaseQuanLi Instance
        {
            get
            {
                if (_Instance == null)
                {
                    lock (locks)
                    {
                        if (_Instance == null)
                            _Instance = new BaseQuanLi();
                    }
                }
                return _Instance;
            }
        }
        #endregion
         
        public List<ICommand> _commands = new List<ICommand>();
        public int Current
        {
            get
            {
                return _commands.Count;

            }
            set
            {
                Current = value;
            }
        }
        public void Undo()
        {
            if (Current > 0)
            {
                var count = (int)Current - 1;
                ICommand cms = _commands[count];
                cms.UnExecute();
            }
        }
    }
}
 

         